<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let num
        let balance = 0
        let i
        while (true) {
            let i = +prompt(`
            1、存钱
            2、取钱
            3、查看余额
            4、退出
            `)
            switch (i) {
                case 1: num = +prompt('请输入您的存款金额')
                    balance = num + balance
                    alert(`存款成功您目前的余额为${balance}`)
                    break
                case 2: let num1 = +prompt('请输入您的取款金额')

                    if (balance - num1 < 0) {
                        alert('操作失败您的余额不足')

                    }
                    else {
                        balance = balance - num1
                        alert(`操作成功您目前的余额为${balance}
                        `)
                    }
                    break
                case 3:
                    alert(`您的余额是${balance}元`)
                    break

            }
            if (i === 4) {
                break
            }

        }
        alert('欢迎下次光临')


    </script>
</body>

</html>